"""
Room schemas for request/response validation.
"""
from pydantic import BaseModel, Field
from typing import Optional, List
from datetime import datetime
from uuid import UUID
from app.models.room import RoomStatus


class RoomBase(BaseModel):
    """Base room schema."""
    name: str = Field(..., min_length=1, max_length=100)
    capacity: int = Field(..., gt=0)
    location: str = Field(..., min_length=1, max_length=200)
    facilities: Optional[List[str]] = []
    status: Optional[RoomStatus] = RoomStatus.ACTIVE


class RoomCreate(RoomBase):
    """Schema for creating a new room."""
    pass


class RoomUpdate(BaseModel):
    """Schema for updating room information."""
    name: Optional[str] = Field(None, min_length=1, max_length=100)
    capacity: Optional[int] = Field(None, gt=0)
    location: Optional[str] = Field(None, min_length=1, max_length=200)
    facilities: Optional[List[str]] = None
    status: Optional[RoomStatus] = None


class RoomInDB(RoomBase):
    """Schema for room in database."""
    id: UUID
    created_at: datetime
    updated_at: datetime
    
    class Config:
        from_attributes = True


class RoomResponse(RoomBase):
    """Schema for room response."""
    id: UUID
    created_at: datetime
    
    class Config:
        from_attributes = True
